/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-05-28 11:29:08
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-06-20 09:48:39
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\linePatrol\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
// import { GetPlanGroupType, RoleType,ParameterListType,XunLineAreaType, EventTypeListType, AddEventType, EditEventType } from './type';
import { TableIResponse } from '@/utils/Api'
import {
  EmergencyEventType,
  EventAssignList,
  EventSolveList,
  PlanEventAssignType,
  PlanEventSoleType,
  PlanEventTrack
} from './type'

export class EmergencyApi {
  //查询应急处理台账
  async GetEmergencyInfo(
    params: EmergencyEventType
  ): Promise<TableIResponse<EmergencyEventType[]>> {
    const result = (await service.get('/api/patrol/planEvent/list', { params })) as unknown as any
    return result
  }
  //删除应急处理台账
  async DeletEmergencyInfo(uuids: string): Promise<boolean> {
    const result = (await service.delete(`/api/patrol/planEvent/${uuids}`)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增应急处理台账
  async AddEmergencyInfo(data: EmergencyEventType): Promise<boolean> {
    const result = (await service.post(
      '/api/patrol/planEvent/addPCEventInfo',
      data
    )) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //修改巡线参数
  async EditEmergencyInfo(data: EmergencyEventType): Promise<boolean> {
    const result = (await service.put('/api/patrol/planEvent', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增指派人员信息
  async AddPlanEventAssign(data: PlanEventAssignType): Promise<boolean> {
    const result = (await service.post('/api/patrol/planEventAssign', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增处置信息
  async AddPlanEventSolve(data: PlanEventSoleType): Promise<boolean> {
    const result = (await service.post('/api/patrol/planEventSolve', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //验收人审核
  async PlanEventSolveQatUser(data: EmergencyEventType): Promise<boolean> {
    const result = (await service.put('/api/patrol/planEventSolve/qatUser', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //新增跟踪记录
  async AddPlanEventTrack(data: PlanEventTrack): Promise<boolean> {
    const result = (await service.post('/api/patrol/planEventTrack', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //查询指派记录
  async GetEventAssignList(params: EventAssignList): Promise<EventAssignList[]> {
    const result = (await service.get('/api/patrol/planEventAssign/list', {
      params
    })) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return []
    }
  }
  //查询处置记录
  async GetEventSolveList(params: EventSolveList): Promise<EventSolveList[]> {
    const result = (await service.get('/api/patrol/planEventSolve/list', {
      params
    })) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return []
    }
  }
  //查询跟踪信息列表
  async GetEventTrackList(params: PlanEventTrack): Promise<PlanEventTrack[]> {
    const result = (await service.get('/api/patrol/planEventTrack/list', {
      params
    })) as unknown as any
    const { code, data } = result
    if (code == 200) {
      return data
    } else {
      return []
    }
  }
}
export default new EmergencyApi()
